package com.ml.loan.sys.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ml.loan.sys.model.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author wangfan
 * @since 2019-02-11
 */
public interface UserMapper extends BaseMapper<User> {

    User selectByUsername(String username);

    @Select("SELECT su.* from sys_user su LEFT JOIN " +
            "sys_user_role sur on su.user_id = sur.user_id LEFT JOIN " +
            "sys_role sr on sur.role_id = sr.role_id " +
            "${ew.customSqlSegment}")
    List<User> getCustomerlist(@Param(Constants.WRAPPER) QueryWrapper<User> queryWrapper);
}
